//
//  MCStoreGoodsLeftCell.swift
//  StoreManage
//
//  Created by MC on 2018/8/31.
//  Copyright © 2018年 MC. All rights reserved.
//

import UIKit

class MCStoreGoodsLeftCell: UITableViewCell {
    
    var model = MCGoodsCategoryModel() {
        didSet {
            
            titleLabel.text = model.name
            signView.isHidden = !model.isChoose
            if model.isChoose {
                bgView.backgroundColor = UIColor.MCGray_light
                titleLabel.textColor = UIColor.MCMain
            } else {
                bgView.backgroundColor = UIColor.white
                titleLabel.textColor = UIColor.MCWords
            }
        }
    }
    
    
    
    override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        
        self.selectionStyle = UITableViewCellSelectionStyle.none

        
        self.addSubview(bgView)
        bgView.snp.remakeConstraints { (make) ->Void in
            make.edges.equalTo(self)
        }
        
        bgView.addSubview(signView)
        signView.snp.remakeConstraints { (make) ->Void in
            make.left.top.bottom.equalTo(bgView)
            make.width.equalTo(3)
        }
        
        bgView.addSubview(titleLabel)
        titleLabel.snp.remakeConstraints { (make) ->Void in
            make.left.equalTo(signView.snp.right)
            make.right.top.bottom.equalTo(bgView)
        }
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    
    
    lazy var bgView: UIView = {
        let view = UIView()
        view.backgroundColor = UIColor.MCGray_light
        return view
    }()
    
    lazy var signView: UIView = {
        let view = UIView()
        view.backgroundColor = UIColor.MCMain
        view.isHidden = true
        return view
    }()
    
    lazy var titleLabel: UILabel = {
        let label = UILabel()
        label.font = MCFont(14)
        label.text = "标签"
        label.textAlignment = NSTextAlignment.center
        return label
    }()
}

